<?php

namespace app\api\controller;


use app\admin\model\City;
use app\api\model\Banner;
use app\common\controller\Api;


/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function adv()
    {

        $value = \app\common\model\Config::get(['name'=>'adv'])->value;

        $this->success('请求成功',$value);
    }

    //协议
    public function agreement()
    {
        $name = input('name','user_agreement');

        $value = \app\common\model\Config::get(['name'=>$name])->value;

        $this->success('请求成功',$value);
    }


    //轮播图
    public function banner()
    {
        $list = Banner::order('weigh desc')->field('image')->select();
        $this->success('请求成功',$list);
    }

    //热门城市
    public function city()
    {
        $city = City::order('weigh desc')->field('id,name,areas_id')->select();
        $this->success('请求成功',$city);
    }

    //客服配置
    public function kefu()
    {
        $data = [
            'kefu_tel'=>\app\common\model\Config::get(['name'=>'kefu_tel'])->value,
            'kefu_qrcode'=>\app\common\model\Config::get(['name'=>'kefu_qrcode'])->value,
        ];
        $this->success('请求成功',$data);
    }

    //站点名称/logo
    public function site()
    {
        $data = [
            'logo'=>\app\common\model\Config::get(['name'=>'logo'])->value,
            'name'=>\app\common\model\Config::get(['name'=>'name'])->value,
        ];
        $this->success('请求成功',$data);
    }
}
